package z_app_lotto2;

import javax.swing.*;
import java.awt.event.*;

public class LottoMenu extends JMenuBar implements ActionListener {
	JMenu file = new JMenu("파일");
	JMenuItem readFile = new JMenuItem("읽기");
	JMenuItem saveFile = new JMenuItem("저장");

	JMenu view = new JMenu("보기");
	JMenuItem list = new JMenuItem("전체목록");
	JMenuItem maxTot = new JMenuItem("전체 최다 발생번호");
	JMenuItem maxLast = new JMenuItem("최근 최다 발생번호");
	JMenuItem minLast = new JMenuItem("최근 최소 발생번호");
	JMenuItem numRelation = new JMenuItem("번호별 연관 번호");

	JMenu simulation = new JMenu("시물레이션");
	JMenuItem simNumRelation = new JMenuItem("연관번호로 예측");

	public LottoMenu() {
		this.add(file);
		this.add(view);
		this.add(simulation);

		addItem(file, readFile);
		addItem(file, saveFile);

		addItem(view, list);
		addItem(view, maxTot);
		addItem(view, maxLast);
		addItem(view, minLast);
		addItem(view, numRelation);

		addItem(simulation, simNumRelation);

	}

	public void addItem(JMenu menu, JMenuItem item) {
		menu.add(item);
		item.addActionListener(this);
	}

	public void actionPerformed(ActionEvent e) {
		if (e.getSource() == readFile) {
			System.out.println(e.getSource());
		}

	}

}